package org.yelongframework.model.support.mybatis.mapping.parameter;

import java.math.BigDecimal;
import java.util.Date;

import org.apache.ibatis.type.JdbcType;

/**
 * 默认实现
 * 
 * @since 1.0.0
 */
public class DefaultMappingParameterTypeDeducer implements MappingParameterTypeDeducer {

	// ==================================================类型推断==================================================

	@Override
	public JdbcType deduce(Object value) {
		if (null == value) {
			return null;
		}
		if (value instanceof CharSequence) {
			return JdbcType.VARCHAR;
		} else if (value instanceof Date) {
			return JdbcType.TIMESTAMP;
		} else if (value instanceof Number || value instanceof BigDecimal) {
			return JdbcType.DECIMAL;
		}
		return null;
	}

}
